GOCMD=go
GORUN=$(GOCMD) run
GOBUILD=CGO_ENABLED=0 $(GOCMD) build
DIST=./build
BINARY=$(DIST)/serve
TARGET_LINUX=GOOS=linux GOARCH=amd64
LDFLAGS=-ldflags "-w -s"
TAGS_INTEGRATION=-tags statics

build-dash-linux:
	mkdir -p $(DIST)/dash/;
	$(TARGET_LINUX) $(GOBUILD) $(LDFLAGS) -o $(DIST)/dash/dash ./cmd/dash
	cp ./cmd/dash/config.yaml $(DIST)/dash/;
	cp ./cmd/dash/zhuanti.json $(DIST)/dash/;
build-collector-linux:
	mkdir -p $(DIST)/collector/;
	$(TARGET_LINUX) $(GOBUILD) $(LDFLAGS) -o $(DIST)/collector/collector ./cmd/collector
	cp ./cmd/collector/config.yaml $(DIST)/collector/;
build-importer-linux:
	mkdir -p $(DIST)/importer/;
	$(TARGET_LINUX) $(GOBUILD) $(LDFLAGS) -o $(DIST)/importer/importer ./cmd/importer
	cp ./cmd/importer/config.yaml $(DIST)/importer/;
build-pipeline-linux:
	mkdir -p $(DIST)/pipeline/;
	$(TARGET_LINUX) $(GOBUILD) $(LDFLAGS) -o $(DIST)/pipeline/pipeline ./cmd/pipeline
	cp ./cmd/pipeline/config.yaml $(DIST)/pipeline/;
build-updatetopic-linux:
	mkdir -p $(DIST)/updatetopic/;
	$(TARGET_LINUX) $(GOBUILD) $(LDFLAGS) -o $(DIST)/updatetopic/updatetopic ./cmd/updatetopic
	cp ./cmd/updatetopic/config.yaml $(DIST)/updatetopic/;
clean-dash:
	rm -rf $(DIST)/dash/
clean-collector:
	rm -rf $(DIST)/collector/;
clean-importer:
	rm -rf $(DIST)/importer/;
clean-pipeline:
	rm -rf $(DIST)/pipeline/
clean-updatetopic:
	rm -rf $(DIST)/updatetopic/
